package com.example

fun main() {
    //两个冒号加函数名字也可以把这个函数引入进来
    showOnBoard2("iPhone",::getDiscount)
}

private fun getDiscount(goodsName:String,hour:Int) :String{
    val currentYear = "2027"
    return "${currentYear}年，双十一${goodsName}促销倒计时: ${hour}小时"
}
private fun showOnBoard2(goodsName:String,showDiscount:(String,Int)->String) {
    val hour = (1..24).shuffled().last()
    println(showDiscount(goodsName,hour))
}